package site.action;

import org.apache.struts2.ServletActionContext;

import site.service.ShopSiteCreateService;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class ShopSiteCreateAction extends ActionSupport {
	private ShopSiteCreateService siteCreateService = new ShopSiteCreateService();

	private String savePath;
	private String fileName = "shop.html";

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getSavePath() {
		return savePath;
	}

	public void setSavePath(String savePath) {
		this.savePath = savePath;
	}

	@Override
	public String execute() throws Exception {
		String realPath = ServletActionContext.getServletContext().getRealPath(
				savePath + "/" + fileName);
		siteCreateService.makeShopSite(realPath, true);
		return Action.SUCCESS;
	}

}
